package com.yh.services.impl;

import com.yh.dao.IPersonDao;
import com.yh.entity.Person;
import com.yh.services.IPersonService;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import java.util.List;

@Getter
@Setter
@Service("personServiceImpl")
public class PersonServiceImpl implements IPersonService {
    @Autowired
    @Qualifier("personDaoImpl")
    private IPersonDao personDao;

    @Override
    public List getAllPerson() {
        return personDao.getAllPerson();
    }

    @Override
    public boolean addPerson(Person p) {

        try {
            personDao.addPerson(p);
            return true;
        } catch (Exception e) {
            return false;
        }
    }

    @Override
    public Person login(Person p) {
        return personDao.login(p);
    }
}
